<template>
  <common-page
    ref="commonPage"
    :bg-path="bgPath"
    :web-path="webPath"
    :columns="columns"
    :search-items="searchItems"
    :form-items="formItems"
  />
</template>
<script>
export default {
  data() {
    return {
      // ===== ===== ===== ===== 全局属性 ===== ===== ===== =====
      // 后台接口路径
      bgPath: 'clinic/clinicdic/clinicdiagdic/clinicchtherapydic',
      // Web路径
      webPath: 'clinic/clinic_dic/clinic_diag_dic/ClinicChTherapyDic',
      // ===== ===== ===== ===== 页面配置 ===== ===== ===== =====
      // 搜索内容
      searchItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "chTherapyDictionaryCode",
              name: "中医治法词典项编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "chTherapyDictionaryName",
              name: "中医治法词典项名称",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "storeCode",
              name: "门店编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "storeName",
              name: "门店名称",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "pinyinCode",
              name: "拼音码",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "effectiveSign",
              name: "有效标识",
              type: "select",
              span: 6,
              config: {
                edit: false,
                keyField: "key",
                valueField: "value",
                options: [
                  { key: "0", value: "无效" },
                  { key: "1", value: "有效" }
                ]
              }
            },
            {
              code: "chDiagDirectoryCode",
              name: "中医症词典编码",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "chDiagDirectoryName",
              name: "中医症词典名称",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            }
          ]
        }
      ],
      // 列表内容
      columns: [
        {
          code: "chTherapyDictionaryCode",
          name: "中医治法词典项编码",
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "chTherapyDictionaryName",
          name: "中医治法词典项名称",
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "storeCode",
          name: "门店编码",
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "storeName",
          name: "门店名称",
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "dicDescribe",
          name: "词典描述",
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "dicWeight",
          name: "词典权重",
          type: "number",
          config: {
            edit: false,
            precision: 2
          }
        },
        {
          code: "pinyinCode",
          name: "关键词",
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "effectiveSign",
          name: "有效标识",
          type: "select",
          config: {
            edit: false,
            keyField: "key",
            valueField: "value",
            options: [
              { key: "0", value: "无效" },
              { key: "1", value: "有效" }
            ]
          }
        },
        {
          code: "chTherapyDirectoryCode",
          name: "中医症词典编码",
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "chTherapyDirectoryName",
          name: "中医病词典名称",
          type: "text",
          config: {
            edit: false
          }
        }
      ],
      // 增加/修改/详情 表单
      formItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "chTherapyDictionaryCode",
              span: 6,
              name: "中医治法词典项编码",
              type: "popup",
              config: {
                url: "base/dictionary/diagdic/chtherapydictionary",
                filedList: [
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    chTherapyDictionaryName: row.name,
                    chTherapyDictionaryCode: row.code,
                    chTherapyDictionaryId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "chTherapyDictionaryName",
              name: "中医治法词典项名称",
              type: "text",
              span: 6,
              config: {
                edit: false,
                require: false,
                disabled: true
              }
            },
            {
              code: "storeCode",
              span: 6,
              name: "门店编码",
              type: "popup",
              config: {
                url: "base/user/user/store",
                filedList: [
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    storeCode: row.code,
                    storeName: row.name,
                    storeId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "storeName",
              name: "门店名称",
              type: "text",
              span: 6,
              config: {
                edit: false,
                require: false,
                disabled: true
              }
            },
            {
              code: "dicDescribe",
              name: "词典描述",
              type: "text",
              span: 6,
              config: {
                edit: false,
                require: false
              }
            },
            {
              code: "dicWeight",
              name: "词典权重",
              type: "number",
              span: 6,
              config: {
                edit: false,
                require: false,
                disabled: false,
                precision: 2
              }
            },
            {
              code: "pinyinCode",
              name: "拼音码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "effectiveSign",
              name: "有效标识",
              type: "select",
              span: 6,
              config: {
                edit: false,
                keyField: "key",
                valueField: "value",
                options: [
                  { key: "0", value: "无效" },
                  { key: "1", value: "有效" }
                ]
              }
            },
            {
              code: "chTherapyDirectoryCode",
              span: 6,
              name: "中医症词典编码",
              type: "popup",
              config: {
                url: "base/dictionary/diagdic/chtherapydirectory",
                filedList: [
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                require: true
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  const formData = {
                    chTherapyDirectoryCode: row.code,
                    chTherapyDirectoryName: row.name,
                    chTherapyDirectoryId: row.id
                  }
                  this.$refs.commonPage.updateFormData(formData)
                }
              }
            },
            {
              code: "chTherapyDirectoryName",
              name: "中医病词典名称",
              type: "text",
              span: 6,
              config: {
                edit: false,
                require: false,
                disabled: true
              }
            }
          ]
        }
      ]
    }
  }
}
</script>
